package com.hu.zhcc.shiro.service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hu.zhcc.shiro.dao.Tj_THealthPlanMapper;
import com.hu.zhcc.shiro.entity.tj.THealthPlan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 健康方案 服务实现类
 * </p>
 *
 * @author tj
 * @since 2021-06-23
 */
@Service
public class Tj_THealthPlanServiceImpl extends ServiceImpl<Tj_THealthPlanMapper, THealthPlan> implements Tj_THealthPlanService {
    @Autowired
    private Tj_THealthPlanMapper tj_tHealthPlanMapper;
    @Override
    public List<THealthPlan> queryAll() {
        return tj_tHealthPlanMapper.queryAll();
    }

    @Override
    public List<THealthPlan> queryLike(THealthPlan tHealthPlan) {
        return tj_tHealthPlanMapper.queryLike(tHealthPlan);
    }

    @Override
    public int addPlan(THealthPlan tHealthPlan) {
        String s = String.valueOf(Integer.parseInt(tj_tHealthPlanMapper.QueryCode())+1);
        tHealthPlan.setCode("FA000"+s);
        tHealthPlan.setCreateTime(new Date());
        System.out.println(tHealthPlan);
        return tj_tHealthPlanMapper.addPlan(tHealthPlan);
    }

    @Override
    public int delPlan(int id) {
        return tj_tHealthPlanMapper.delPlan(id);
    }

    @Override
    public THealthPlan queryById(int id) {
        return tj_tHealthPlanMapper.queryById(id);
    }

    @Override
    public int updPlan(THealthPlan tHealthPlan) {
        tHealthPlan.setUpdateTime(new Date());
        int i = tj_tHealthPlanMapper.updPlan(tHealthPlan);
        return i;
    }


}
